package com.zr.inquiry.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zr.util.PageVo;
import lombok.Data;

import java.util.Date;

/**
 * Created by 天赐 on 2019/12/27.
 */
@Data
public class inquirytotal extends PageVo{
    private Integer id;
    private String requestForQuotationId;
    private Integer legalPersonId;
    private String vendor;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/beijing")
    private Date startTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/beijing")
    private Date endTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/beijing")
    private Date createStartTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/beijing")
    private Date createEndTime;

    private String partnerName;
    private Integer inquiryStatus;
    private String inquiryStatusName;


    private Integer type;
    private String legalPersonName;






    private Integer pageIndex;//当前页
    private Integer pageSize;//每页大小
    private Integer offset;//索引数

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
        initParamter();
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getOffset() {
        return offset;
    }

    public void setOffset(Integer offset) {
        this.offset = offset;
    }

    private void initParamter(){
        if (pageIndex==null){//默认第一页
            pageIndex=1;
        }
        if (pageIndex<1){
            pageIndex=1;
        }
        if (this.pageSize==null){
            this.pageSize=10;
        }
        if (this.pageSize==0){
            this.pageSize=10;//默认每页多少条数据
        }
        final int startIndex = (this.pageIndex-1)*this.pageSize;
        setOffset(startIndex);
    }
}
